import React, { Component } from 'react';
import { Link } from 'react-router-dom'

class List extends Component {
  constructor(props) {
    super(props);
    this.state = {
      list: [
        { id: 1, title: '吃早餐' },
        { id: 2, title: '吃午餐' },
        { id: 3, title: '吃晚餐' },
        { id: 4, title: '玩游戏' },
      ]
    }
  }
  render() {
    return (
      <ul>
        {
          this.state.list.map((item, index) => {
            return (
              <li key={index}>
                <Link to={'/list/' + item.id}>{item.title}</Link>
              </li>
            )
          })
        }
      </ul>
    );
  }
}

export default List;